home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-05-01 | 3.6 KB | 144 lines | [TEXT/MPS ] |
- {
- File: AdminMessagePort.p
-
- Contains: xxx put contents here xxx
-
- Version: Technology: xxx put the technology version here xxx
- Release: Universal Interfaces 3.0d3 on Copland DR1
-
- Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved.
-
- Bugs?: If you find a problem with this file, send the file and version
- information (from above) and the problem description to:
-
- Internet: apple.bugs@applelink.apple.com
- AppleLink: APPLE.BUGS
-
- }
- {$IFC UNDEFINED UsingIncludes}
- {$SETC UsingIncludes := 0}
- {$ENDC}
-
- {$IFC NOT UsingIncludes}
- UNIT AdminMessagePort;
- INTERFACE
- {$ENDC}
-
- {$IFC UNDEFINED __ADMINMESSAGEPORT__}
- {$SETC __ADMINMESSAGEPORT__ := 1}
-
- {$I+}
- {$SETC AdminMessagePortIncludes := UsingIncludes}
- {$SETC UsingIncludes := 1}
-
- {$IFC UNDEFINED __TYPES__}
- {$I Types.p}
- {$ENDC}
-
- {$PUSH}
- {$ALIGN MAC68K}
- {$LibExport+}
-
- {$IFC FOR_SYSTEM8_PREEMPTIVE }
- {
- //------------------------------------------------------------------------------------
-
- The I/O system reserves one bit of the Kernel message system's type mask to use
- for administration messages. Different services within the I/O system use this
- single message type. The routine and constants described in this file are used
- by clients of these administration services to distinguish between the different
- types.
-
- It is intended that clients of I/O administration services use a single Kernel
- message port (PortID) for all messages: administration and data. Clients can
- create multiple message objects (ObjectID) for the same port and pass a different
- object to each administration service and use another for data handling.
-
- The client should use separate tasks to receive administration messages and data
- messages. Use the message type parameter of ReceiveMessage as a bit-mask to specify
- the type of message to receive in each task. The code below shows an example of an
- administration task.
-
- AdministrationTask()
- (
- MessageControlBlock mcb;
- union (
- DevNMessage devn;
- PMMessage pm;
- Arbitration arb;
- ) adminBuffer;
- UInt32 messageType;
-
- while (true)
- (
- ReceiveMessageSync(adminPort, kAMPMessageTypeMask, &mcb, &adminBuffer, ...)
- AMPGetMessageType(mcb->messageContents, &messageType);
-
- switch (messageType)
- (
- case kAMPDeviceNotificationMsg:
- (
- DevNMessage* devn = mcb.messageContents;
- switch (devn->subMessageType)
- (
- ...
- )
- )
- break;
- case kAMPPowerManagementMsg:
- (
- PMMessage* pm = mcb.messageContents;
- switch (pm->type)
- (
- ...
- )
- )
- break;
- case kAMPArbitrationServiceMsg:
- (
- Arbitration* arb = mcb.messageContents;
- switch (arb->type)
- (
- ...
- )
- )
- break;
- default:
- break;
- )
- )
- )
-
- //------------------------------------------------------------------------------------
- }
- { Constants for use in ReceiveMessage. }
-
- CONST
- kAMPMessageTypeMask = $08000000; { highest bit not reserved by the kernel }
- kNonKernelNonAMPMessageTypes = $07FFFFFF;
-
- { Constants returned by AMPGetMessageType }
- kAMPDeviceNotificationMsg = 1;
- kAMPPowerManagementMsg = 2;
- kAMPArbitrationServiceMsg = 3;
-
- {
- AMPGetMessageType:
-
- Given an I/O administration message this routine determines the type of
- message. If the type cannot be deteremined zero is returned and debugging
- builds throw an assertion.
- }
- PROCEDURE AMPGetMessageType(messageContents: UNIV Ptr; VAR messageType: UInt32); C;
- {$ENDC}
- {$ALIGN RESET}
- {$POP}
-
- {$SETC UsingIncludes := AdminMessagePortIncludes}
-
- {$ENDC} {__ADMINMESSAGEPORT__}
-
- {$IFC NOT UsingIncludes}
- END.
- {$ENDC}
-